package com.sh.common.core.enums;

import cn.hutool.core.util.ObjectUtil;
import lombok.AllArgsConstructor;
import lombok.Getter;

@Getter
@AllArgsConstructor
public enum UserLevelEnum {

    /**
     * 普通用户
     */
    NORMAL(-1, ""),

    /**
     * V
     */
    V(0, "代理"),

    /**
     * V1
     */
    V1(1, "区代理"),

    /**
     * V2
     */
    V2(2, "县代理"),

    /**
     * V3
     */
    V3(3, "市代理"),

    /**
     * V4
     */
    V4(4, "省代理"),

    /**
     * V5
     */
    V5(5, "全国代"),

    /**
     * V6
     */
    V6(6, "全球代"),


    ;


    private final Integer code;
    private final String info;

    public static UserLevelEnum of(Integer code) {
        for (UserLevelEnum value : values()) {
            if (ObjectUtil.equals(code, value.getCode())) {
                return value;
            }
        }
        throw new RuntimeException("'UserLevel' not found By " + code);
    }
}
